function getNarcissisticNumbers(n) {
	if (n == 1) {
		return [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
	}

	let arr = new Array()
	for (let i = Math.pow(10, n - 1); i < Math.pow(10, n); i++) {
		let num = i.toString()
		let temp = 0
		for (let j = 0; j < num.length; j++) {
			temp += Math.pow(num[j], n)
		}
		if (temp === i) {
			arr.push(temp)
		}
	}
	return arr
}

console.log(getNarcissisticNumbers(4))


// console.log(Number(300).toString()[2])
